class HttpExceoption extends Error {
    constructor (msg='服务器发生了未知错误', status=999, code=500) {
        super()
        this.msg = msg
        this.status = status
        this.code = code
    }
}

class Success extends HttpExceoption {
    constructor(msg, status) {
        super()
        this.msg = msg || '操作成功'
        this.status = status || 0
        this.code = 200
    }
}

class FailError extends HttpExceoption {
    constructor(msg, status) {
        super()
        this.msg = msg || '操作失败'
        this.status = status || 1
        this.code = 400
    }
}

class ParameterException extends HttpExceoption {
    constructor(msg, status) {
        super()
        this.msg = msg || '参数校验出现了错误'
        this.status = status || 1000
        this.code = 400
    }
}

class NotFound extends HttpExceoption {
    constructor(msg, status) {
        super()
        this.msg = msg || '资源不存在'
        this.status = status || 1001
        this.code = 404
    }
}

class Forbidden extends HttpExceoption {
    constructor(msg, status) {
        super()
        this.msg = msg || '禁止访问'
        this.status = status || 1002
        this.code = 403
    }
}

class VeifyCodeError extends HttpExceoption {
    constructor(msg, status) {
        super()
        this.msg = msg || '验证码校验出错'
        this.status = status || 1003
        this.code = 400
    }
}

class AuthError extends HttpExceoption {
    constructor(msg, status) {
        super()
        this.msg = msg || '授权失败'
        this.status = status || 1004
        this.code = 401
    }
}

module.export = {
    HttpExceoption,
    Success,
    FailError,
    ParameterException,
    NotFound,
    Forbidden,
    VeifyCodeError,
    AuthError
}
